import test.Temperature;
import test.WeatherStation;

/**
 * @Author: Wyndem
 * @Description: 观察者模式
 * @Date: Created in  2019-01-20 19:49
 * @Modified By:
 */
public class Main {

    public static void main(String[] args) {

        //创建天气站
        WeatherStation weatherStation = new WeatherStation();

        //创建温度版
        Temperature temperature = new Temperature(weatherStation);

        //订阅
        weatherStation.addObservers(temperature);

        //有更新
        weatherStation.notifyAllObservers();

        //温度发生变化
        weatherStation.setTemperature(53.0);

        //有更新
        weatherStation.notifyAllObservers();

    }


}
